home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / imageio.lib / dev / includes / imageio / imageio.h < prev   
Encoding:
C/C++ Source or Header  |  2000-10-23  |  9.1 KB  |  208 lines

  1. #ifndef IMAGEIO_H
  2. #define IMAGEIO_H
  3.  
  4. /*
  5. **    $VER: imageio.h 3.1 (30.6.2000)
  6. **
  7. **    Public structures and definitions for imageio.library.
  8. **
  9. **    © Paul Huxham
  10. */
  11.  
  12. #ifndef EXEC_TYPES_H
  13. #include "exec/types.h"
  14. #endif
  15.  
  16. #ifndef DOS_DOS_H
  17. #include <dos/dos.h>
  18. #endif
  19.  
  20. #ifndef UTILITY_TAGITEM_H
  21. #include <utility/tagitem.h>
  22. #endif
  23.  
  24. #ifndef IMAGEGENERIC_H
  25. #include <imageio/imagegeneric.h>
  26. #endif
  27.  
  28. /*========================================================================*/
  29. /* Public object handle */
  30.  
  31. /* Used for imageio access */
  32. struct ImageHandle
  33. {
  34.     ULONG private;
  35. };
  36.  
  37. /*========================================================================*/
  38. /* Public filetype list:
  39.         Returned as an array of structs with filetype == NULL at end of list */
  40. struct ImageFormat
  41. {
  42.     UBYTE filetype; // Defined below
  43.  
  44.     UBYTE reserved0;
  45.     WORD reserved1;
  46.  
  47.     ULONG end; // If not NULL then there are more entries in the array
  48.     ULONG reserved2, reserved3, reserved4;
  49.     ULONG writeable; // If non NULL, image is writeable
  50.     ULONG reserved5;
  51. };
  52.  
  53. /*========================================================================*/
  54. /* Colour spaces, retreive these as UBYTEs */
  55. #ifdef IMAGEIO_COMPAT
  56.     #define IRCS_UNKNOWN IMCS_UNKNOWN
  57.     #define IRCS_RGB IMCS_RGB
  58.     #define IRCS_GREY IMCS_GREY
  59.     #define IRCS_ARGB IMCS_ARGB
  60.     #define IRCS_RGBA IMCS_RGBA
  61. #endif
  62.  
  63. /* For return buffer as a particular type */
  64. #define IMCS_ASLOADED IMCS_UNKNOWN
  65.  
  66. /*========================================================================*/
  67. /* Filetypes */
  68. #define IMGF_SUPERVIEW 253 /* Is not really a filetype by itself */
  69. #define IMGF_DATATYPE 254 /* Is not really a filetype by itself */
  70. #define IMGF_MEMORY 255 /* A buffer stored already in memory */
  71.  
  72. /*========================================================================*/
  73. /* Public callback hooks */
  74.  
  75. /* The storage hook is called once for each scanline in the image.
  76.         a0 contains a UBYTE pointer to the scanline to copy
  77.         d0 contains a ULONG with the scanline number of this data (1 being
  78.                 first scanline)
  79.         d1 contains a ULONG with the number of bytes in this row
  80.         a1 contains the userdata
  81.  
  82.     If the hook returns a non NULL value, the reading will be aborted -
  83.     You should NOT call any functions other than FreeImage() on that object.
  84. */
  85.  
  86. typedef ULONG (*IMGS_HOOK)( void *, ULONG, ULONG, void * );
  87. typedef __asm ULONG (*IMGS_HOOK_PROTO)( register __a0 void *, register __d0 ULONG, register __d1 ULONG, register __a1 void * );
  88.  
  89. /* The progress hook is called once for each scanline in the image (during
  90.         reading).
  91.         d0 contains a ULONG with the current scanline number (1-n).
  92.         d1 contains a ULONG with the total number of scanlines.
  93.         a0 contains the userdata
  94.  
  95.     If the hook returns a non NULL value, the reading will be aborted -
  96.     You should NOT call any functions other than FreeImage() on that object.
  97. */
  98.  
  99. typedef ULONG (*IMGP_HOOK)( ULONG, ULONG, void * );
  100. typedef __asm ULONG (*IMGP_HOOK_PROTO)( register __d0 ULONG, register __d1 ULONG, register __a0 void * );
  101.  
  102. /* The render hook is called once for each decompressed scanline in the
  103.         image.
  104.         a0 contains a UBYTE pointer to the scanline data
  105.         d0 contains a ULONG with the scanline number of this data (1 being
  106.                 first scanline)
  107.         d1 contains a ULONG with the number of bytes in this row
  108.         a1 contains the userdata
  109.  
  110.     If the hook returns a non NULL value, the reading will be aborted -
  111.     You should NOT call any functions other than FreeImage() on that object.
  112. */
  113.  
  114. typedef ULONG (*IMGR_HOOK)( void *, ULONG, ULONG, void * );
  115. typedef __asm ULONG (*IMGR_HOOK_PROTO)( register __a0 void *, register __d0 ULONG, register __d1 ULONG, register __a1 void * );
  116.  
  117. /*========================================================================*/
  118. /* ImageIO tagbase */
  119. #define IMG_TB ( TAG_USER + 0x80000 )
  120.  
  121. /* ImageIO tags requiring V1.0 */
  122. #define IMG_SrcMemStream IMG_TB + 1 /* Pointer to stream data in memory (UBYTE *) */
  123. #define IMG_SrcMemStreamSize IMG_TB + 2 /* Length in bytes of data stream (ULONG) */
  124. #define IMG_SrcFile IMG_TB + 3 /* Pointer to an open file to load (BPTR) */
  125. #define IMG_ImageBuffer IMG_TB + 4 /* Pointer to a memory block (UBYTE *) */
  126. #define IMG_StorageHook IMG_TB + 5 /* Pointer to a function to store scan lines */
  127. #define IMG_StorageUserData IMG_TB + 6 /* Pointer to user data (void *) */
  128. #define IMG_ProgressHook IMG_TB + 7 /* Pointer to a function to display progress status */
  129. #define IMG_ProgressUserData IMG_TB + 8 /* Pointer to user data (void *) */
  130. #define IMG_RenderHook IMG_TB + 9 /* Pointer to a function to render decoded scan lines */
  131. #define IMG_RenderUserData IMG_TB + 10 /* Pointer to user data (void *) */
  132. #define IMG_MemoryPool IMG_TB + 11 /* All de/allocs are on this memory pool (void *) [U] */
  133. #define IMG_ScaleNum IMG_TB + 12 /* Numerator for scaling (ULONG) */
  134. #define IMG_TestScaleNum IMG_TB + 13 /* Test numerator for scaling (ULONG) [USE] */
  135. #define IMG_ScaleDenom IMG_TB + 14 /* Denomenator for scaling (ULONG) */
  136. #define IMG_TestScaleDenom IMG_TB + 15 /* Test denomenator for scaling (ULONG) [USE] */
  137. #define IMG_Width IMG_TB + 16 /* Width of image in pixels (ULONG *) */
  138. #define IMG_Height IMG_TB + 17 /* Height of image in pixels (ULONG *) */
  139. #define IMG_BytesPerPixel IMG_TB + 18 /* Number of bytes per image pixel (ULONG *) */
  140. #define IMG_RowSize IMG_TB + 19 /* Size of one row (ULONG *) [GET only] */
  141. #define IMG_ColourSpace IMG_TB + 20 /* Type of image data (UBYTE *) [GET only] */
  142. #define IMG_ImageType IMG_TB + 21 /* Image type, defined above (UBYTE *) */
  143. #define IMG_AsciiImageType IMG_TB + 22 /* Ascii image type (char *, minimum 8 characters in length) */
  144.  
  145. /* These tags are passed to the image loading if it is of the same type */
  146. #define IMG_JPEG_DCTMethod IMG_TB + 23 /* The DCT processing method */
  147.  
  148. #define IMG_JPEG_Quality IMG_TB + 24 /* Jpeg save quality 1-100 () */
  149. #define IMG_JPEG_Progressive IMG_TB + 25 /* Save in progressive format (BOOL) */
  150. #define IMG_QuerySaveable IMG_TB + 26 /* *Query* saveable in this format (UBYTE *) */
  151. #define IMG_RGBBuffer IMG_TB + 27 /* Points to an existing RGB buffer in memory (UBYTE *) */
  152. #define IMG_AllowEncoded IMG_TB + 28 /* Allow the decoding of ascii encoded files, defaults to FALSE. Overrides users preferences (BOOL) */
  153. #define IMG_MakeReturnedBuffer IMG_TB + 29 /* Make the returned buffer pointer this type (UBYTE) - see colour spaces (NOT IMPLEMENTED) */
  154. #define IMG_IsDecoded IMG_TB + 31 /* Is the image loaded from a decoded file format (eg UU) (BOOL) [G] */
  155. #define IMG_DecodedName IMG_TB + 32 /* Copy into this char *, the filename of the encodedfile (char *) [G] */
  156. #define IMG_WriteDecodedFile IMG_TB + 33 /* Write the decoded file to this path/filename (char *) */
  157.  
  158. #define IMG_ImagePlanar IMG_TB + 34 /* Image data is planar [G] ULONG * */
  159. #define IMG_ImageChunky IMG_TB + 35 /* Image data is chunky [G] ULONG * */
  160. #define IMG_ImageHAM6 IMG_TB + 36 /* Image data is HAM6 [G] ULONG * */
  161. #define IMG_ImageHalfBrite IMG_TB + 37 /* Image data is HALFBRITE [G] ULONG **/
  162. #define IMG_ImageHAM8 IMG_TB + 38 /* Image data is HAM8 [G] ULONG * */
  163. #define IMG_Image24Bit IMG_TB + 39 /* Image data is 24BIT [G] ULONG * */
  164. #define IMG_ImagePalette IMG_TB + 40 /* Image data is 24BIT [G] ULONG * */
  165. #define IMG_ImageGrey IMG_TB + 41 /* Image data has grey scale palette [G] ULONG * */
  166. #define IMG_ImageFormat IMG_TB + 42 /* Flags field of ilbm image [G] UBYTE * */
  167. #define IMG_ImageDepth IMG_TB + 43 /* Colour depth of ilbm image [G] UBYTE * */
  168.  
  169. /* New for Version 3.0 */
  170. #define IMG_SrcFilename IMG_TB + 44 /* Pointer to a path/filename to load (char *) */
  171.  
  172. /*========================================================================*/
  173. /* JPEG DCT methods */
  174. #ifdef IMAGEIO_COMPAT
  175.     #include <jpeg/jpeg.h>
  176.     #define JPEG_DCT_ISLOW DCT_ISLOW
  177.     #define JPEG_DCT_IFAST DCT_IFAST
  178.     #define JPEG_DCT_FLOAT DCT_FLOAT
  179. #endif
  180.  
  181. /*========================================================================*/
  182. /* Defined error return codes */
  183. #define IMGERR_NONE 0 /* No error */
  184. #define IMGERR_NOMEMORY 1 /* Insufficient memory */
  185. #define IMGERR_NOHANDLE 2 /* No image handle supplied */
  186. #define IMGERR_CREATEOBJECT 3 /* Failed to create image object */
  187. #define IMGERR_READFAILURE 4 /* Failed to read image */
  188. #define IMGERR_NOSRCSTREAM 5 /* No source stream to read */
  189. #define IMGERR_READABORTED 6 /* Reading aborted by user hook */
  190. #define IMGERR_ALREADYREAD 7 /* Handle has already been read */
  191. #define IMGERR_NOTKNOWN 8 /* The stream is in an unknown format */
  192. #define IMGERR_CORRUPT 9 /* The stream is corrupt */
  193. #define IMGERR_BADHANDLE 10 /* Handle not initialized correctly (internal) */
  194. #define IMGERR_NOINFO 11 /* Cant get image information from the handle */
  195. #define IMGERR_NOBUFFER 12 /* No image buffer */
  196. #define IMGERR_MISSINGTARGET 13 /* Missing target variable pointer */
  197. #define IMGERR_NOTLOADED 14 /* The image is not loaded yet */
  198. #define IMGERR_BADSCALESIZE 15 /* Out of range scaling parameters */
  199. #define IMGERR_SAVENOTSUPPORTED 16 /* Saving in this format not supported */
  200. #define IMGERR_FILEEXISTS 17 /* Save file already exists - not saved */
  201. #define IMGERR_WRITEABORTED 18 /* Writing aborted by user hook */
  202. #define IMGERR_WRITEFAILURE 19 /* Failed to write image */
  203. #define IMGERR_NOTENCODED 20 /* Image is not ascii encoded */
  204. #define IMGERR_NOFILENAME 21 /* No path/filename supplied */
  205. #define IMGERR_FILENOTFOUND 22 /* File not found */
  206.  
  207. #endif /* IMAGEIO_H */
  208.